<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>二手商品交易管理后台</title>
	<script type="text/javascript" src="js/jquery-2.1.1.js"></script>
	<link rel="stylesheet" href="css/reset.css">
	<link rel="stylesheet" href="css/public.css">
</head>
<body>
<div class="public-header-warrp">
	<div class="public-header">
		<div class="content">
			<div class="public-header-logo"><a href=""><i>LOGO</i><h3>二手物品交易系统</h3></a></div>
			<div class="public-header-admin fr">
				<p class="admin-name">管理员 <a style="background:red"> ${sessionScope.admininfo.adminname  }</a> 您好！</p>
				<div class="public-header-fun fr">
					<a onclick="Exit();" class="public-header-loginout" style="cursor:pointer";>安全退出</a>	
				</div>
			</div>
		</div>
	</div>
</div>
<div class="clearfix"></div>
<!-- 内容展示 -->
<div class="public-ifame mt20">
	<div class="content">
	
		<div class="clearfix"></div>
		<!-- 左侧导航栏 -->
		<div class="public-ifame-leftnav">
			<div class="public-title-warrp">
				<div class="public-ifame-title ">
					<a href="">首页</a>
				</div>
			</div>
			<ul class="left-nav-list">
				<li class="public-ifame-item">
					<a href="javascript:;">管理员管理</a>
					<div class="ifame-item-sub">
						<ul>
							<li class="active"><a id="adminmanager"  target="content" style="cursor:pointer;" onmousedown="adminservlet('${pageContext.request.contextPath}');" onmouseup="showadmin('${sessionScope.adminface}');">管理员列表</a></li>
							<li><a onclick="addadmin();" target="content" style="cursor:pointer;" style="corsur:pointer">新增管理员</a></li>
							
						</ul>
					</div>
				</li>
				<li class="public-ifame-item">
					<a href="javascript:;">用户管理</a>
					<div class="ifame-item-sub">
						<ul>
							<li><a onmousedown="showuser('${pageContext.request.contextPath}');" onmouseup="showuserinfo('${sessionScope.userface}');" target="content" id="usermanager" style="cursor:pointer;">用户列表</a></li>
							
						</ul>
					</div>
				</li>
				<li class="public-ifame-item">
					<a href="javascript:;">分类管理</a>
					<div class="ifame-item-sub">
						<ul>
							<li><a onmousedown="showtype('${pageContext.request.contextPath}');" onmouseup="showtypeinfo('${sessionScope.typeface}');" target="content" id="usermanager" style="cursor:pointer;">分类列表</a></li>
							<li><a onclick="addtype();" target="content" style="cursor:pointer;">新增分类</a></li>
						</ul>
					</div>
				</li>
				<li class="public-ifame-item">
					<a href="javascript:;">商品管理</a>
					<div class="ifame-item-sub">
						<ul>
							<li><a onmousedown="showgoods('${pageContext.request.contextPath}');" onmouseup="showgoodsinfo('${sessionScope.goodsface}');" target="content" style="cursor:pointer;">商品列表</a></li>
						</ul>
					</div>
				</li>
				
				
			</ul>
		</div>
		<!-- 右侧内容展示部分 -->
		<div class="public-ifame-content">
		<iframe name="content" id="ifa" src="admin_main.jsp" frameborder="0" id="mainframe" scrolling="yes" marginheight="0" marginwidth="0" width="100%" style="height: 700px;"></iframe>
		</div>
	</div>
</div>
<script src="js/jquery.min.js"></script>
<script>
	
	
function adminservlet(url){
		//alert(1);
		var url = url+'/servlet/pagequeryadmin';
		ifa.src = url;
		//alert(url);
	}
	function showadmin(adminface){

		//alert(adminface);
		if(adminface==1){
			ifa.src = "admin_manager.jsp";
		}
	}

	
	

	function addadmin(){
		var url = "admin_add_admin.jsp";
		ifa.src = url;
	}
//-----------------------------------------------------------------------------

	function showuser(url){
		var url =  url+'/servlet/pagequeryuserservlet';
		ifa.src = url;
	}
	function showuserinfo(userface){
	//显示查询用户表是否成功
		//alert(userface)
		if(userface==2){
			ifa.src = "admin_user_manager.jsp";
		}
	}
	//------------------------------------------------------------------------
	//访问查询商品servlet
	function showgoods(url){
		var url =  url+'/servlet/pagequerygoodsservlet';
		ifa.src = url;
}

	function showgoodsinfo(goodsface){
		//alert(goodsface);
		if(goodsface==3){
			ifa.src = "goods.jsp";
		}
	}
//------------------------------------------------------------------
	//访问查询商品类别servlet
	function showtype(url){
		var url =  url+'/servlet/pagequerygoodstype';
		ifa.src = url;
	}

	function showtypeinfo(typeface){
			//alert(typeface);
		if(typeface==4){
			ifa.src = "typelist.jsp";
		}
	}


	function addtype(){
		var url = "addtype.jsp";
		ifa.src = url;
	}
//--------------------------------------------------------------------------
	function Exit(){
		var url = '${pageContext.request.contextPath}/background/Admin_login.jsp';
		window.location.href=url;
	}
$().ready(function(){
	
	var item = $(".public-ifame-item");

	for(var i=0; i < item.length; i++){
		$(item[i]).on('click',function(){
			$(".ifame-item-sub").hide();
			if($(this.lastElementChild).css('display') == 'block'){
				$(this.lastElementChild).hide()
				$(".ifame-item-sub li").removeClass("active");
			}else{
				$(this.lastElementChild).show();
				$(".ifame-item-sub li").on('click',function(){
					$(".ifame-item-sub li").removeClass("active");
					$(this).addClass("active");
				});
			}
		});
	}
});

</script>
</body>
</html>